<?php
// No direct access to this file
defined('_JEXEC') or die;
 
// import the list field type
jimport('joomla.html.html');
jimport('joomla.form.formfield');
jimport('joomla.form.helper');
JFormHelper::loadFieldClass('list');
 
/**
 * NGMenu Form Field class for the NGMenu component
 */
class JFormFieldMenuTemplate extends JFormFieldList
{
	/**
	 * The field type.
	 *
	 * @var		string
	 */
	protected $type = 'MenuTemplate';
 
//	public function getLabel() {
//	}
 
	public function getInput() {
	
		$db		=& JFactory::getDBO();
		$query	= $db->getQuery(true);
	
		$query->select('a.template, a.title');
		$query->from('`#__template_styles` AS a');
		$query->where('a.client_id = 0');
		$query->order('a.title');
		$db->setQuery($query);
		$templates = $db->loadObjectList();

		$template_values = array();
		$template_values[] = JHtml::_('select.option', '0', JText::_('COM_NGMENU_LIST_VALUES_INDEPENDENT'));
		foreach($templates as $template){
			$template_values[] = JHtml::_('select.option', $template->template, $template->title);
		}
		
		return JHtml::_('select.genericlist', $template_values, $this->name, null, 'value', 'text', $this->value );
	}
}
